Learn R Programming

spam (version 1.2-1)

fields wrapper: Wrapper for Distance Matrix Computation

Description

These functions are simple wrappers to nearest.dist to be used in fields.

Usage

spam_rdist( x1, x2, delta = 1)
spam_rdist.earth( x1, x2, delta = 1, miles=TRUE, R=NULL)

Arguments

x1
Matrix of first set of locations where each row gives the coordinates of a particular point.
x2
Matrix of second set of locations where each row gives the coordinates of a particular point.
delta
only distances smaller than delta are recorded
miles
For great circle distance: If true distances are in statute miles if false distances in kilometers.
R
Radius to use for sphere to find spherical distances. If NULL the radius is either in miles or kilometers depending on the values of the miles argument. If R=1 then distances are of course in radians

Value

  • A spam object containing the distances spanned between zero and delta. The sparse matrix may contain many zeros (e.g., collocated data). However, to calculate covariances, these zeros are essential.

Details

These functions are wrappers to rdist and rdist.earth in fields. They are used to simplify the use of sparse matrices in functions like mKrig.

See Also

nearest.dist

Examples

Run this code
require(fields)
look <- mKrig(x,Y, Covariance="Wendland", dimension=2, k=1,
    cov.args=list( Distance='spam_rdist'))

Run the code above in your browser using DataLab